package com.jichangxiu.common.entity.po;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * BaseEntity:
 *
 * @author Jcx
 * @create 2023-04-03 21:49
 */
@Data
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableField("create_by")
    @Schema(description = "创建者")
    private String createBy;

    @TableField("create_time")
    @Schema(description = "创建时间")
    private Date createTime;

    @TableField("update_by")
    @Schema(description = "更新者")
    private String updateBy;

    @TableField("update_time")
    @Schema(description = "更新时间")
    private Date updateTime;

    @TableField(exist = false)
    private Map<String, Object> params;

    public Map<String, Object> getParams() {
        if (ObjectUtil.isEmpty(params)) {
            params = new HashMap<>();
        }
        return params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }

}
